package com.proxyhub.model;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

/**
 * Created by linxsh on 2017/6/15.
 */
@Document(collection="proxy")
public class Proxy {
    @Id
    private String id;
    /**
     * IP地址
     */
    private String host;
    /**
     * 端口
     */
    private int port;
    /**
     * 类型：高匿、透明
     */
    private String type;
    /**
     * 地理位置
     */
    private String location;
    /**
     * 是否支持https
     */
    private boolean https;
    /**
     * 延迟
     */
    private int delay;
    /**
     * 创建时间
     */
    private Date createDate;
    /**
     * 如果依旧可用，返回最早一次验证可用的时间
     */
    private Date lastValidDate;
    /**
     * 是否有效
     */
    private Boolean valid = false;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public boolean isHttps() {
        return https;
    }

    public void setHttps(boolean https) {
        this.https = https;
    }

    public int getDelay() {
        return delay;
    }

    public void setDelay(int delay) {
        this.delay = delay;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public Boolean getValid() {
        return valid;
    }

    public void setValid(Boolean valid) {
        this.valid = valid;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getLastValidDate() {
        return lastValidDate;
    }

    public void setLastValidDate(Date lastValidDate) {
        this.lastValidDate = lastValidDate;
    }

    public Proxy() {
    }

    public Proxy(String host, int port) {
        this.host = host;
        this.port = port;
    }

    public Proxy(String host, int port, String type, String location, boolean https, int delay) {
        this.host = host;
        this.port = port;
        this.type = type;
        this.location = location;
        this.https = https;
        this.delay = delay;
        this.createDate = new Date();
    }

    public Proxy(String host, int port, String type, String location, boolean https, int delay, boolean valid) {
        this.host = host;
        this.port = port;
        this.type = type;
        this.location = location;
        this.https = https;
        this.delay = delay;
        this.createDate = new Date();
        this.valid = valid;
    }
}
